<?php
class appController extends Controller {    

    protected function init(){    
        $this->db = new MySqlDataAdapter($this->cfg['db']['hostname'], $this->cfg['db']['username'], 
        $this->cfg['db']['password'], $this->cfg['db']['database']);
    }
    
    public function index(){
        $data = $this->_model->read();
        
        if(MyHelpers::isAjax()){
            header('Content-type: application/json');
            echo $data;
        }else{
            $this->view->set('items',$data);
            return $this->view();
        }
    }
}